/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package cifar10.util;

import cifar10.util.Alphabet;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.PrintWriter;

/**
 *
 * @author mwh
 */
public class SVMToSubmission {
    
    public static void main(String args[]) throws IOException{
        
        Alphabet alphabet = new Alphabet();
        alphabet.load("targets.alp");
        
        String fn = "/home/mwh/kaggle/cifar10/featurefiles/test-j-AutoColorCorrelogram.svm.out";
        
        PrintWriter writer = new PrintWriter(fn + ".sub");
        writer.println("id,label");
        
        BufferedReader reader = new BufferedReader(new FileReader(fn));
        String line;
        int c=1;
        while ((line= reader.readLine()) != null) {
            int svmLabel = Integer.parseInt(line);
            String label = alphabet.getName(svmLabel);
            writer.println(c+","+label);
            c++;
        }
        
        reader.close();
        writer.close();
    }
}
